package com.xz.stu.server.controller;


import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import com.xz.stu.server.service.DashboardService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("admin-api/dashboard")
public class DashboardController {

    @Resource
    private DashboardService dashboardService;

    @GetMapping("/summary")
    public CommonResult<Map<String, Object>> getDashboardData() {
        return CommonResult.success(dashboardService.getDashboardSummary());
    }

    @GetMapping("/department-scores")
    public CommonResult<Map<String, Object>> getDepartmentScores(
            @RequestParam(value = "term", required = false) String term) {
        return CommonResult.success(dashboardService.getDepartmentScores(term));
    }

    @GetMapping("/score-distribution")
    public CommonResult<Map<String, Object>> getScoreDistribution(
            @RequestParam(value = "term", required = false) String term) {
        return CommonResult.success(dashboardService.getScoreDistribution(term));
    }
    @GetMapping("/trend-data")
    public CommonResult<Map<String, Object>> getTrendData() {
        return CommonResult.success(dashboardService.getTrendData());
    }

}
